package com.oncecloud.devops.service.sample.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.oncecloud.devops.service.sample.service.UserService;

/**
 * 用户信息控制器
 * @author mayunhao
 *
 */
@RestController
@RequestMapping("/user")
public class UserController {
	@Autowired
	private UserService userService;
	@RequestMapping(value = "/list", method = { RequestMethod.GET })
	@ResponseBody
	public String getUsers(@RequestParam(value = "userName", required = false)String userName){
		return userService.getUsers(userName);
	}
	@RequestMapping(value = "/detail", method = { RequestMethod.GET })
	@ResponseBody
	public String getUserDetail(@RequestParam(value = "userId", required = false)Integer userId){
		return userService.getUserDetail(userId);
	}
}
